const Mock = require('mockjs')

const img = [
    'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fww1.sinaimg.cn%2Fmw690%2F001M3Mcbly1gjvrssaex7j63n83n8kjp02.jpg&refer=http%3A%2F%2Fwww.sina.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1611919354&t=9d65fb759c1945e1242b51e0bf9a060f',
    'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3155998395,3600507640&fm=26&gp=0.jpg',
    'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201510%2F18%2F20151018172940_5etXi.jpeg&refer=http%3A%2F%2Fb-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1611919469&t=83461f38906839d3b52c2e7a51ed739a',
    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1441836571,2166773131&fm=26&gp=0.jpg',
    'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3582194852,1481557220&fm=26&gp=0.jpg',
    'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fc-ssl.duitang.com%2Fuploads%2Fblog%2F202011%2F16%2F20201116144255_fbec6.thumb.1000_0.jpeg&refer=http%3A%2F%2Fc-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1611919644&t=7b51260d1f5500038fda227f06888cdb',
    'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2315146696,3189809923&fm=26&gp=0.jpg',
    'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201501%2F30%2F20150130004848_UTsAu.thumb.700_0.jpeg&refer=http%3A%2F%2Fb-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1611919699&t=e6dd0e941e8bc9a719aa0eccd11797a4',
    'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1074188057,1218579293&fm=26&gp=0.jpg',
    'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1950846641,3729028697&fm=26&gp=0.jpg',
    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=347107276,1959396700&fm=11&gp=0.jpg',
    'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=289237221,199580710&fm=26&gp=0.jpg',
    'https://image.baidu.com/search/detail?ct=503316480&z=0&ipn=false&word=%E5%A4%B4%E5%83%8F&step_word=&hs=0&pn=387&spn=0&di=213620&pi=0&rn=1&tn=baiduimagedetail&is=0%2C0&istype=0&ie=utf-8&oe=utf-8&in=&cl=2&lm=-1&st=undefined&cs=208155123%2C970589869&os=3884857991%2C203103760&simid=3441860545%2C171948184&adpicid=0&lpn=0&ln=30&fr=&fmq=1609327339494_R&fm=&ic=undefined&s=undefined&hd=undefined&latest=undefined&copyright=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&ist=&jit=&cg=head&bdtype=0&oriquery=%E5%A4%B4%E5%83%8F&objurl=https%3A%2F%2Fgimg2.baidu.com%2Fimage_search%2Fsrc%3Dhttp%3A%2F%2Fpic1.zhimg.com%2F50%2Fv2-1ae9b2bbc17daaeb0a5d12184063a30f_hd.jpg%26refer%3Dhttp%3A%2F%2Fpic1.zhimg.com%26app%3D2002%26size%3Df9999%2C10000%26q%3Da80%26n%3D0%26g%3D0n%26fmt%3Djpeg%3Fsec%3D1611919811%26t%3D552e6899171237ac252b2bfa98044028&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bziti7_z%26e3Bv54AzdH3Fq7jfpt5gAzdH3Fn8anncm8bAzdH3Fwgfoj6AzdH3Fmdbdb8b99&gsm=184&rpstart=0&rpnum=0&islist=&querylist=&force=undefined',
    'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1340127580,1407454083&fm=26&gp=0.jpg',
    'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1296984525,3378929106&fm=26&gp=0.jpg',
    'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3033361221,2752676077&fm=26&gp=0.jpg',
    'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2541308253,3190372927&fm=26&gp=0.jpg',
    'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1878145874,2802724191&fm=26&gp=0.jpg',
    'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2292908988,3239045523&fm=26&gp=0.jpg',
    'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1365983964,600966652&fm=26&gp=0.jpg'
]
module.exports = {
    //获取筛选条件列表
    [`GET /people/occupational`](req, res) {
        res.status(200).json(Mock.mock({
            "message": "获取信息成功",
            "data": {
                "results": [
                    {
                        //学历
                        "name": "学历",
                        "parmas": "education",
                        "list": [
                            {
                                "item_id|0-999": 0,
                                "item_name": "小学"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "初中"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "中专"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "职高"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "高中"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "大专"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "本科"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "研究生及以上"
                            }
                        ]
                    },
                    {
                        //职业分类
                        "name": "职业类型",
                        "params": "occupational",
                        "list": [
                            {
                                'item_id': 0,
                                'item_name': '月嫂',
                            }, {
                                'item_id': 1,
                                'item_name': '育婴师',
                            }, {
                                'item_id': 2,
                                'item_name': '产康师',
                            }, {
                                'item_id': 3,
                                'item_name': '保姆',
                            }, {
                                'item_id': 4,
                                'item_name': '保洁/清洁',
                            }, {
                                'item_id': 5,
                                'item_name': '早教/托育',
                            }, {
                                'item_id': 6,
                                'item_name': '养老/陪护',
                            }, {
                                'item_id': 7,
                                'item_name': '家装/搬家',
                            },
                            {
                                'item_id': 8,
                                'item_name': '全部职业',
                            }
                        ]
                    },
                    {
                        //民族
                        "name": "民族",
                        "params": "nation",
                        "list": [
                            {
                                "item_id|0-999": 0,
                                "item_name": "汉族"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "蒙古族"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "回族"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "藏族"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "维吾尔族"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "苗族"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "彝族"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "壮族"
                            }
                        ]
                    },
                    {
                        //婚姻状况
                        "name": "婚姻状况",
                        "params": "marriage",
                        "list": [
                            {
                                "item_id|0-999": 0,
                                "item_name": "未婚"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "已婚"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "离异"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "丧偶"
                            }
                        ]
                    },
                    {
                        //星座
                        "name": "星座",
                        "params": "constellation",
                        "list": [
                            {
                                "item_id|0-999": 0,
                                "item_name": "白羊座"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "金牛座"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "双子座"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "巨蟹座"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "狮子座"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "处女座"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "天秤座"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "天蝎座"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "射手座"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "摩羯座"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "水瓶座"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "双鱼座"
                            }
                        ]
                    },
                    {
                        //生肖
                        "name": "生肖",
                        "params": "zodiac",
                        "list": [
                            {
                                "item_id|0-999": 0,
                                "item_name": "鼠"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "牛"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "虎"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "兔"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "龙"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "蛇"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "马"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "羊"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "猴"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "鸡"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "狗"
                            }, {
                                "item_id|0-999": 0,
                                "item_name": "猪"
                            }
                        ]
                    },
                    {
                        //工作年限
                        "name": "工作年限",
                        "params": "years",
                        "list": [
                            {
                                "item_id|0-999": 0,
                                "item_name": "1年经验"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "2年经验"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "3年经验"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "4年经验"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "5年经验"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "6年经验"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "7年经验"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "8年经验"
                            },
                            {
                                "item_id|0-999": 0,
                                "item_name": "9年经验"
                            },
                        ]
                    },
                    {
                        //主要技能
                        "name": "主要技能",
                        "params": "main",
                        "list|8": [
                            {
                                "item_id|0-999": 0,
                                "item_name": "@ctitle(2,4)"
                            },
                        ]
                    }
                ]
            }
        }))
    },
    //根据筛选条件获取人员列表
    [`POST /people`](req, res) {
        //如果不传参数，则返回默认数据
        if (JSON.stringify(req.body) == '{}') {
            res.status(200).json(Mock.mock({
                "message": "获取信息成功",
                "data": {
                    "page|1-999": 1,   //当前页数
                    "per_page": 3,    //每页数量
                    "results|3": [
                        {
                            "peo_id|0-999": 0,
                            "peo_name": '@cname',
                            "peo_desc": '@city(true) | @integer(18,50)岁 | 服务@integer(1,20)户 | 评价@integer(1,100)',
                            "peo_tags|1-3": [
                                {
                                    "tag_id|0-999": 0,
                                    "tag_title|1": ["协会成员", "服务好", "环境优美", "效率高", "质量保证", "快速上门"]
                                }
                            ],
                            "peo_money": "@integer(3,20)000/26天",
                            "photo|1": img
                        }
                    ]
                }
            }))
        } else {
            res.status(201).json(Mock.mock({
                "message": "获取信息成功",
                "data": {
                    "page|1-999": 1,   //当前页数
                    "per_page": 10,    //每页数量
                    "results|10": [
                        {
                            "peo_id|0-999": 0,
                            "peo_name": '@cname',
                            "peo_desc": '@city(true) | @integer(18,50)岁 | 服务@integer(1,20)户 | 评价@integer(1,100)',
                            "peo_tags|1-3": [
                                {
                                    "tag_id|0-999": 0,
                                    "tag_title|1": ["协会成员", "服务好", "环境优美", "效率高", "质量保证", "快速上门"]
                                }
                            ],
                            "peo_money": "@integer(3,20)000/26天",
                            "photo|1": img
                        }
                    ]
                }
            }))
        }
    }
}